frappe.ui.form.on('Stock Entry', {
	refresh(frm) {
		// your code here
	}
})

frappe.ui.form.on('Stock Entry Detail', {
    // 库存设置-序列号与批号- （勾选）启用明细行批号与序列号字段
    // 发料扫批号时获取批号结余数量
	batch_no(frm, cdt, cdn) {
		let child = locals[cdt][cdn];
		let warehouse = child.s_warehouse;
		if (warehouse){
    		frappe.call({
    			method: "erpnext.stock.doctype.batch.batch.get_batch_qty",
    			args: {
    				batch_no: child.batch_no,
    				warehouse: warehouse
    			},
    			callback: (r) => {
    				if (r.message) {
    					frappe.model.set_value(cdt, cdn, "qty", r.message);
    				}
    			}
    		})
		}
	}
})